//
//  DCLeixingCellCell.m
//  diaoyuren
//
//  Created by 钓鱼人 on 16/3/7.
//  Copyright © 2016年 game. All rights reserved.
//

#import "DCLeixingCellCell.h"

@interface DCLeixingCellCell ()
@property (weak, nonatomic) IBOutlet UIButton *Btn;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *btnHeight;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *btnWidth;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *linHight;

@end

@implementation DCLeixingCellCell

- (void)awakeFromNib {
    
    self.selectionStyle = 0;
    self.linHight.constant = 0.4;
    
    self.text.font = font(SCREEN_WIDTH*0.04);
    
    self.btnHeight.constant = SCREEN_HEIGHT*0.06-10;
    
    self.btnWidth.constant =  self.btnHeight.constant;
}

-(void)setResultString:(NSString *)resultString{
    _resultString = resultString;
    
   
    NSArray *realtArr = [_resultString componentsSeparatedByString:@" "];
    
    for (NSString *str  in realtArr) {
        if ([self.text.text isEqualToString:str]) {
            
            
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                if (_cellBtnClick) {
                    _cellBtnClick();
                }
            });
            
            
            
        }
    }
    




}

-(void)setSelect:(BOOL)Select{

    _Select = Select;
    if (_Select) {
        self.text.textColor = mainColor;
        self.Btn.selected = YES;
    }else{
        self.text.textColor = [UIColor blackColor];
        self.Btn.selected = NO;
    }
}
- (IBAction)btnAction:(UIButton *)sender {
    if (_cellBtnClick) {
        _cellBtnClick();
    }
}

@end
